<!DOCTYPE html>
<html class="x-admin-sm">
    <head>
        <meta charset="UTF-8">
        <title>产品入库</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="stylesheet" href="/static/css/font.css">
        <link rel="stylesheet" href="/static/css/xadmin.css">
        <script src="/static/lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="/static/js/xadmin.js"></script>
		<script type="text/javascript" src="/static/js/jquery.min.js"></script>
		<script type="text/javascript" src="/static/js/jquery.form.js"></script>
        <!--[if lt IE 9]>
          <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
          <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>
    <body>
        <div class="x-nav">
          <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
            <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
        </div>
        <div class="layui-fluid" style="background:#fff;">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
					<fieldset class="layui-elem-field">
					  <legend>产品入库</legend>
					  <div class="layui-field-box">
						<div class="layui-tab layui-tab-brief">
						  <ul class="layui-tab-title">
							<li class="layui-this">入库信息</li>
						  </ul>
						  <form class="layui-form" id="signupForm" action="{:url('shop/goods/editstorage')}" method="post">
							  <div class="layui-tab-content">
								<div class="layui-form-item">
									<div class="layui-inline">
									  <label class="layui-form-label">IMEI</label>
									  <div class="layui-input-inline">
										<input type="text" name="imei" class="layui-input" value="{$stock.imei}"/>
									  </div>
									</div>
									<div class="layui-inline">
									  <label class="layui-form-label">S/N</label>
									  <div class="layui-input-inline">
										<input type="text" name="sn" class="layui-input" value="{$stock.sn}"/>
									  </div>
									</div>
								 </div>
								 <div class="layui-form-item">
									<div class="layui-inline">
									  <label class="layui-form-label">入库数量</label>
									  <div class="layui-input-inline">
										<input type="text" name="number" lay-verify="required" class="layui-input" value="{$stock.number}"/>
									  </div>
									</div>
								 </div>
								  <div class="layui-form-item">
									<div class="layui-inline">
									  <label for="phone" class="layui-form-label">进货单价</label>
									  <div class="layui-input-inline">
										  <input type="text" name="buying_price" class="layui-input" value="{$stock.buying_price}"/>
									  </div>
									</div>
									<div class="layui-inline">
									  <label class="layui-form-label">保质期</label>
									  <div class="layui-input-inline">
										<input type="text" name="period_time" id="start" class="layui-input" value="{$stock.period_time|date='Y-m-d',###}"/>
									  </div>
									</div>
								 </div>
								 <div class="layui-form-item">
									<div class="layui-inline">
									  <label for="username" class="layui-form-label">供应商</label>
										<div class="layui-input-inline">
											<select name="supplier_id">
												{volist name="supp" id="vo"}
												<option value="{$vo.supplier_id}" {if condition="$vo.supplier_id eq $stock.supplier_id"}selected{/if}>{$vo.supplier_name}</option>
												{/volist}
											</select>
										</div>
									</div>
									<div class="layui-inline">
									  <label class="layui-form-label">合同编号</label>
									  <div class="layui-input-inline">
										<input type="text" name="contract_sn" class="layui-input" value="{$stock.contract_sn}"/>
									  </div>
									</div>
								 </div>
								 <div class="layui-form-item">
									<label class="layui-form-label">所在位置</label>
									<div class="layui-input-block">
									  <input type="radio" name="position" value="0" title="门店" {if condition="$stock.position eq '0'"}checked=""{/if} />
									  <input type="radio" name="position" value="1" title="仓库" {if condition="$stock.position eq '1'"}checked=""{/if}/>
									</div>
									<div class="layui-input-inline">
										<input type="text" name="remarks" class="layui-input" value="{$stock.remarks}"/>
									</div>
								  </div>
								  <div class="layui-form-item">
									  <label for="L_repass" class="layui-form-label">
										<input type="hidden" name="id" value="{$stock.stock_id}"/>
									  </label>
									  <button  class="layui-btn" lay-filter="add" lay-submit="">修改</button>
								  </div>
							  </div>
						  </form>
						</div>
					  </div>
					</fieldset>
                </div>
            </div>
        </div> 
    </body>
     <script>
		var flag = true;
		layui.use(['laydate','form','layer'],
            function() {
                $ = layui.jquery;
                var form = layui.form,
                layer = layui.layer;
				var laydate = layui.laydate;
				
				 //执行一个laydate实例
				laydate.render({
				  elem: '#start', //指定元素
				  min:'nowTime',
				});
                //监听提交
                form.on('submit(add)',
                function(data) {
                    if(flag)
					{
						flag = false;
						$("#signupForm").ajaxSubmit(function (message) {
							 if(message.code == 10001)
							 {
								layer.msg("编辑成功", {
									icon: 6
								},
								function() {
									//关闭当前frame
									xadmin.close();
									// 可以对父窗口进行刷新 
									xadmin.father_reload();
								});
							 }else{
								layer.msg(message.msg, {
									icon: 5
								},
								function() {
									//关闭当前frame
									xadmin.close();
									// 可以对父窗口进行刷新 
									xadmin.father_reload();
								});
							 }
						});
					}else{
						layer.msg('正在提交。。。', {icon: 6});
					}
                    return false;
                });
				
            });
		</script>
</html>